/**
 * @module NGS
 * @author Kevin.MOU
 */
define(function() {
	var MultiAsync = function(callback) {
		this.callback = callback;
		this.threads = [];
	};

	MultiAsync.prototype = {
		start : function(key) {
			this.threads.push(key);
		},
		end : function(key) {
			this.threads.remove(key);
			this.check();
		},
		check : function() {
			if (this.threads.length == 0)
				this.callback();
		}
	};

	return {
		create : function(callback) {
			return new MultiAsync(callback);
		}
	}
})
